<template>
  <svg :style="{ width: width, height: height }" aria-hidden="true">
    <template v-if="color">
      <use :xlink:href="prefix + name" :fill="color" />
    </template>
    <template v-else>
      <use :xlink:href="prefix + name" />
    </template>
  </svg>
</template>
<script setup>
defineProps({
  //xlink:href属性值的前缀
  prefix: {
    type: String,
    default: "#icon-",
  },
  //svg矢量图的名字
  name: String,
  //svg图标的颜色
  color: {
    type: String,
    default: "",
  },
  //svg宽度
  width: {
    type: String,
    default: "16px",
  },
  //svg高度
  height: {
    type: String,
    default: "16px",
  },
});
</script>
<style lang="scss" scoped></style>
